package com.gc;

import java.util.ArrayList;
import java.util.List;

/**
 * @author xiangui
 * 描述:
 * 时间: Create in 11:56 2018/7/17
 */
public class testNeiCun {

    static class OOMObject{
        public byte[] placeholder = new byte[64 * 1024];
    }

    private static void fillHeap(int num) throws InterruptedException {
        List<OOMObject> list = new ArrayList<>();

        for(int i = 0; i < num; i++){
            Thread.sleep(1000);
            list.add(new OOMObject());
        }
        System.gc();

    }

    public static void main(String[] args) throws InterruptedException {
        fillHeap(1000);
    }

}
